package com.saxon.springcloud.controller;

import com.saxon.springcloud.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerDept {
    @Autowired
    RestTemplate restTemplate;

    public static final String REQUEST_URL="http://SAXON";

    @GetMapping("/consumer/dept/get/{id}")
    public Dept queryDeptById(@PathVariable("id") long id){
        return restTemplate.getForObject (REQUEST_URL+"/get/ "+id,Dept.class,Long.class);
    }

}
